<?php
namespace App\Http\Middleware;

use App\Exceptions\StandardException;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;

class CheckUnionId
{
    public function handle(Request $request, \Closure $next)
    {
        $user = Auth::user();
        if (empty($user->unionid)) {
            throw new StandardException('需要授权', 1002);
        }
        return $next($request);
    }
}
